<?php

/**
 *  @FileComment            [商品属性表]
 *  @ProjectName             项目名称：shopFrame
 *  @FileName                   文件名称：GoodsAttr.Model.class.php
 *  @Author                       yuerengui <596580041@qq.com>
 *  @Date                          2014-10-12 19:08:06
 *  *
 */
class GoodsAttrModel extends Model {

        public $table = 'goods_attr';

        public function get_data($gid) {
                return $this->where(array('gid' => $gid))->all();
        }

        public function get_one_data($gid, $gaid) {
                return $this->where(array('goods_gid' => $gid, 'gaid' => $gaid))->getField('ganame');
        }

        public function get_all_data($where = NULL, $group = NULL) {
                return $this->group($group)->where($where)->all();
        }

        public function get_ganame($where) {
                return $this->where($where)->getField('ganame', TRUE);
        }

        public function get_field($where) {
                return $this->where($where)->getField('added', TRUE);
        }

}
